import 'package:flutter/material.dart';
import 'package:framelib/utils/color_util.dart';
import 'package:framelib/utils/px_util.dart';
import 'package:framelib/utils/string_util.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

// 选择的类型
enum SelectedType {
  CancelType,
  SelectedPhotoType,
  SelectedCameraType,
}
// ignore: must_be_immutable
class SelectPhotoOrCameraAlertWidget extends StatelessWidget {

  SelectedType _selectedType = SelectedType.SelectedPhotoType;

  @override
  Widget build(BuildContext context) {
    return Container(
      height: px_160.h,
      child: Column(
        children: <Widget>[
          buildRow("${string_album}",context),
          // SizedBox(height: 1,),
          Container(
            height: px_0d5.h,
            width: MediaQuery.of(context).size.width,
            decoration: BoxDecoration(
              color: color_cccccc
            ),
            child: Text(''),
          ),
          buildRow("${string_camera}",context),
          Container(
            height: px_2.h,
            width: MediaQuery.of(context).size.width,
            decoration: BoxDecoration(
                color: color_cccccc
            ),
            child: Text(''),
          ),
          buildRow("${string_cancel}",context),
        ],
      ),
    );
  }

  Widget buildRow(String text,BuildContext context) {
    return InkWell(
      child: Container(
        // color: Colors.white,
        height: px_50.h,
        alignment: Alignment.center,
        child: Text(text,style: TextStyle(
            color: Colors.black87,
            fontSize: px_16.sp),),
      ),
      onTap: () {
        if(text == "${string_cancel}") {
          _selectedType = SelectedType.CancelType;

        }else if(text == "${string_camera}") {
          _selectedType = SelectedType.SelectedCameraType;

        }else {
          _selectedType = SelectedType.SelectedPhotoType;
        }
        Navigator.of(context).pop(_selectedType);
      },
    );
  }
}
